package vn.com.tiz.DocumentZ.test;

import javax.xml.datatype.XMLGregorianCalendar;

import vn.com.tiz.DocumentZ.task.GetXmlTask;
import vn.com.tiz.DocumentZ.task.GetXmlTask.OnGetXmlCompleted;
import vn.com.tiz.DocumentZ.utils.LogTools;

import android.app.Activity;
import android.content.res.Configuration;
import android.os.Bundle;
import android.os.Handler;
import android.util.Log;
import android.view.Gravity;
import android.widget.Button;
import android.widget.TextView;

public class actTestXmlGet extends Activity{

	TextView txv;
	Handler handler;
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		// TODO Auto-generated method stub
		super.onCreate(savedInstanceState);
		txv = new TextView(this);
		txv.setText("Loading...");
		setContentView(txv);
		txv.setGravity(Gravity.CENTER);
		
		handler = new Handler();
		
		String url = "http://staging-spapi.disney.co.jp/AppAPI/V2.0/ApplicationInformation/GetVersionInfo?AppId=1000009&OutputDivision=1&CarrierCategory=4&PackageName=jp.co.disney.disneymobile.calculator";
		//url = "http://vnexpress.net/rss/gl/trang-chu.rss";				
		
		GetXmlTask xmlTask = new GetXmlTask(url);
		xmlTask.setOnGetXmlCompleted(new OnGetXmlCompleted() {
			
			public void GetXmlCompleted(String result) {
				// TODO Auto-generated method stub
				LogTools.debug("Load complete:"+result);
				handler.post(new Runnable() {
					
					public void run() {
						// TODO Auto-generated method stub
						txv.setText("Done");
					}
				});
				
			}
		});
		
		Thread th = new Thread(xmlTask);
		th.start();
		
		//xmlTask.run();
		//this.
		Log.i("TrungTT","test..");
		
	}
	
	@Override
	public void onConfigurationChanged(Configuration newConfig) {
		// TODO Auto-generated method stub
		//super.onConfigurationChanged(newConfig);
	}
}
